<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
<h:body>
<h:panelGroup rendered="#{sessaoMB.usuario.administrador}" >
	<h:outputStylesheet library="css" name="estilo.css" />

	<f:view>
		<ui:include src="../topo.xhtml"></ui:include>
	</f:view>
	<div class="container">
		<div class="navegacao">&nbsp;&nbsp;&nbsp; Inicio > Cadastro > Ambiente</div>

		<div class="conteudo">
			<div class="formCad">
				<h:form id="form">
					<p:growl showDetail="true"></p:growl>
					<h:outputLabel value="Numero &nbsp;"></h:outputLabel>
					<h:inputText value="#{cadastroAmbienteMB.nome}"></h:inputText>
					<p>&nbsp;</p>
					<h:outputLabel value="Descricão &nbsp;"></h:outputLabel>
					<h:inputText value="#{cadastroAmbienteMB.descricao}"></h:inputText>
					<p>&nbsp;</p>
					<h:outputLabel value="Bloco &nbsp;"></h:outputLabel>
					<h:selectOneMenu value="#{cadastroAmbienteMB.codigoBloco}">
						<f:selectItem id="item6" itemLabel=" .:   Selecione   :. "
							itemValue="" />
						<f:selectItems value="#{cadastroAmbienteMB.listaDeBloco}"
							var="bloco" itemValue="#{bloco.codigo}" itemLabel="#{bloco.nome}" />
							 <p:ajax event="change" update="form:tipo" listener="#{cadastroAmbienteMB.carregarTipoDeAmbiente}"></p:ajax>
					</h:selectOneMenu>
					<p>&nbsp;</p>
					<h:outputLabel value="Tipo de Ambiente &nbsp;"></h:outputLabel>
					<h:selectOneMenu value="#{cadastroAmbienteMB.codigoTipoAmbiente}" id="tipo">
						<f:selectItem itemLabel=" .:   Selecione   :. " itemValue="" />
						<f:selectItems value="#{cadastroAmbienteMB.listaDeTipoAmbientes}"
							var="tipoAmbiente" itemValue="#{tipoAmbiente.codigo}"
							itemLabel="#{tipoAmbiente.nome}" />
					</h:selectOneMenu>
					<p>&nbsp;</p>
					<p:commandButton value="Cadastrar"
						actionListener="#{cadastroAmbienteMB.cadastrar}" update="form"></p:commandButton>
				</h:form>
			</div>
		</div>
	</div>
	<div class="rodape">
		<ui:include src="/rodape.xhtml"></ui:include>
	</div>
	</h:panelGroup>
</h:body>
</html>